<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width" />
    <title>Media Chrome Mobile Video Usage Example</title>
    <script type="module" src="../../dist/index.js"></script>
    <style>
      /** add styles to prevent CLS (Cumulative Layout Shift) */
      media-controller:not([audio]) {
        display: block;         /* expands the container if preload=none */
        max-width: 375px;       /* allows the container to shrink if small */
        aspect-ratio: 16 / 9;   /* set container aspect ratio if preload=none */
      }

      video {
        width: 100%;      /* prevents video to expand beyond its container */
      }

      .examples {
        margin-top: 20px;
      }

      media-airplay-button[mediaairplayunavailable] {
        display: none;
      }

      media-volume-range[mediavolumeunavailable] {
        display: none;
      }

      /* Breaking these up into two selectors to demonstrate how this could work with a new custom "contaienr" element (CJP) */
      media-controller .centered-controls-overlay {
        align-self: stretch;
      }

      .centered-controls-overlay {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        justify-content: center;
        gap: 6%;
        margin: -5% auto 0;
        width: 60%;
      }

      *[slot='centered-chrome'] [role='button'] {
        border-radius: 50%;
        aspect-ratio: 1;
      }

      *[slot='centered-chrome'] media-play-button {
        width: 20%;
      }

      *[slot='centered-chrome']
        :is(media-seek-backward-button, media-seek-forward-button) {
        width: 15%;
        padding: 8px;
      }

      media-time-range {
        --media-range-track-height: 5px;
        --media-range-track-backdrop-filter: blur(5px);
        --media-range-padding: 0;
        --media-range-thumb-opacity: 0;
        background: none;
        height: var(--media-range-track-height);
        width: 100%;
      }

      .spacer {
        background: rgb(20 20 30 / .7);
        flex-grow: 1;
      }
    </style>
  </head>
  <body>
    <main>
      <h1>Media Chrome Standard Mobile Video Usage Example</h1>
      <media-controller autohide="2" defaultduration="134">
        <video
          slot="media"
          src="https://stream.mux.com/Sc89iWAyNkhJ3P1rQ02nrEdCFTnfT01CZ2KmaEcxXfB008/high.mp4"
          preload="none"
          muted
          crossorigin
          playsinline
        >
          <track
            label="thumbnails"
            default
            kind="metadata"
            src="https://image.mux.com/Sc89iWAyNkhJ3P1rQ02nrEdCFTnfT01CZ2KmaEcxXfB008/storyboard.vtt"
          />
        </video>
        <media-poster-image
          slot="poster"
          src="https://image.mux.com/Sc89iWAyNkhJ3P1rQ02nrEdCFTnfT01CZ2KmaEcxXfB008/thumbnail.webp?time=13"
        ></media-poster-image>
        <div slot="centered-chrome" class="centered-controls-overlay">
          <media-seek-backward-button></media-seek-backward-button>
          <media-play-button></media-play-button>
          <media-seek-forward-button></media-seek-forward-button>
        </div>
        <media-time-range></media-time-range>
        <media-control-bar>
          <media-mute-button></media-mute-button>
          <media-time-display showduration remaining></media-time-display>
          <div class="spacer"></div>
          <media-playback-rate-button></media-playback-rate-button>
          <media-pip-button></media-pip-button>
          <media-fullscreen-button></media-fullscreen-button>
          <media-airplay-button></media-button-button>
        </media-control-bar>
      </media-controller>
      <div class="examples">
        <a href="./">View more examples</a>
      </div>
    </main>
  </body>
</html>
